package com.gitee.magic.converter;

import com.gitee.magic.core.converter.AbstractConverterEditor;

/**
 * @author start
 */
public class ByteArrayConverterEditor extends AbstractConverterEditor<String> {

	public ByteArrayConverterEditor(Class<?> prototype) {
		super(prototype);
	}

	@Override
	public void restore(Object value) {
		if(value!=null) {
			setValue(String.valueOf(value).getBytes());
		}
	}

	@Override
	public String converter() {
		byte[] value = (byte[]) getValue();
		return (value != null ? new String(value) : "");
	}

}
